/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.games.epkb.entityClasses;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author plebani
 */
@Entity
@Table(name = "file_usage")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FileUsage.findAll", query = "SELECT f FROM FileUsage f"),
    @NamedQuery(name = "FileUsage.findById", query = "SELECT f FROM FileUsage f WHERE f.id = :id"),
    @NamedQuery(name = "FileUsage.findByDefinitionTime", query = "SELECT f FROM FileUsage f WHERE f.definitionTime = :definitionTime"),
    @NamedQuery(name = "FileUsage.findByFileName", query = "SELECT f FROM FileUsage f WHERE f.fileName = :fileName"),
    @NamedQuery(name = "FileUsage.findByNumberRead", query = "SELECT f FROM FileUsage f WHERE f.numberRead = :numberRead"),
    @NamedQuery(name = "FileUsage.findByNumberWrite", query = "SELECT f FROM FileUsage f WHERE f.numberWrite = :numberWrite")})
public class FileUsage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Column(name = "DefinitionTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date definitionTime;
    @Basic(optional = false)
    @Column(name = "FileName")
    private String fileName;
    @Column(name = "NumberRead")
    private BigInteger numberRead;
    @Column(name = "NumberWrite")
    private BigInteger numberWrite;
    @JoinColumn(name = "Id_Activity", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Activity idActivity;

    public FileUsage() {
    }

    public FileUsage(Long id) {
        this.id = id;
    }

    public FileUsage(Long id, String fileName) {
        this.id = id;
        this.fileName = fileName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getDefinitionTime() {
        return definitionTime;
    }

    public void setDefinitionTime(Date definitionTime) {
        this.definitionTime = definitionTime;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public BigInteger getNumberRead() {
        return numberRead;
    }

    public void setNumberRead(BigInteger numberRead) {
        this.numberRead = numberRead;
    }

    public BigInteger getNumberWrite() {
        return numberWrite;
    }

    public void setNumberWrite(BigInteger numberWrite) {
        this.numberWrite = numberWrite;
    }

    public Activity getIdActivity() {
        return idActivity;
    }

    public void setIdActivity(Activity idActivity) {
        this.idActivity = idActivity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FileUsage)) {
            return false;
        }
        FileUsage other = (FileUsage) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "it.polimi.games.epkb.entityClasses.FileUsage[ id=" + id + " ]";
    }
    
}
